<template>
  <div>
    <div style="margin-bottom:15px;">
      Your roles: {{ roles }}
    </div>
    Switch roles:
    <el-radio-group v-model="switchRoles" @change="handleChange">
      <el-radio-button label="editor" />
      <el-radio-button label="admin" />
    </el-radio-group>
  </div>
</template>

<script>
export default {
  data() {
    return {
      switchRoles: 'admin'
    }
  },
  computed: {
    roles() {
      return this.$store.getters.roles
    }
  },
  methods: {
    handleChange(val) {
      this.$store.commit('userinfo/SET_ROLES', [val])
      this.$emit('change')
    }
  }
}
</script>
